        // Global variable to track current file name.
        var currentFile = "";
        
        function playAudio() {
            // Check for audio element support.
            if (window.HTMLAudioElement) {
                try {
                    var oAudio = document.getElementById('myaudio');
                    var btn = document.getElementById('play'); 
                    var audioURL = document.getElementById('audiofile'); 

                    //Skip loading if current file hasn't changed.
                    if (audioURL.value !== currentFile) {
                        oAudio.src = audioURL.value;
                        currentFile = audioURL.value;                       
                    }

                    // Tests the paused attribute and set state. 
                    if (oAudio.paused) {
                        oAudio.play();
                        btn.textContent = "Pause";
                    }
                    else {
                        oAudio.pause();
                        btn.textContent = "Play";
                    }
                }
                catch (e) {
                    // Fail silently but show in F12 developer tools console
                     if(window.console && console.error("Error:" + e));
                }
            }
        }
		
		//操作全局变量 authorWords，是一位数组
		//authorWords = unicode2Chr(authorWords);
		var wordsNum = authorWords.length;
		var curWords = 0;
        function gotoNext() {
			curWords++;
			if(curWords > wordsNum){
				curWords = 0;
			}
            x = document.getElementById("words");  // 找到元素
            x.innerHTML = authorWords[curWords].content;    // 改变内容
            
            }
        function gotoPrevious() {
            curWords--;
            if(curWords < 0){
				curWords = wordsNum;
			}
            x = document.getElementById("words");  // 找到元素
            x.innerHTML = authorWords[curWords].content;    // 改变内容
            
            }
function unicode2Chr(str) {
	return unescape(str.replace(/\\/g, "%"))
}
   